import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AttendanceAlarmVO, AttendanceAlarmForm, AttendanceAlarmQuery } from '@/api/dormitory/attendanceAlarm/types';

/**
 * 查询宿舍告警记录列表
 * @param query
 * @returns {*}
 */

export const listAttendanceAlarm = (query?: AttendanceAlarmQuery): AxiosPromise<AttendanceAlarmVO[]> => {
  return request({
    url: '/dormitory/attendanceAlarm/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询宿舍告警记录详细
 * @param id
 */
export const getAttendanceAlarm = (id: string | number): AxiosPromise<AttendanceAlarmVO> => {
  return request({
    url: '/dormitory/attendanceAlarm/' + id,
    method: 'get'
  });
};

/**
 * 新增宿舍告警记录
 * @param data
 */
export const addAttendanceAlarm = (data: AttendanceAlarmForm) => {
  return request({
    url: '/dormitory/attendanceAlarm',
    method: 'post',
    data: data
  });
};

/**
 * 修改宿舍告警记录
 * @param data
 */
export const updateAttendanceAlarm = (data: AttendanceAlarmForm) => {
  return request({
    url: '/dormitory/attendanceAlarm',
    method: 'put',
    data: data
  });
};

/**
 * 删除宿舍告警记录
 * @param id
 */
export const delAttendanceAlarm = (id: string | number | Array<string | number>) => {
  return request({
    url: '/dormitory/attendanceAlarm/' + id,
    method: 'delete'
  });
};
